#include "stdafx.h"
#include "NavigationConfig.h"

NavigationConfig::NavigationConfig()
{
}

NavigationConfig::~NavigationConfig()
{
}

bool NavigationConfig::getNeedNavigation()
{
	
	if (!fileFind.FindFile(_T("NAVIGATION.dat"), 0))
	{
		navigationFile.Open(_T("NAVIGATION.dat"), CFile::modeCreate | CFile::modeWrite);
		needNavigation[0]='1';                     
		navigationFile.Write(needNavigation,strlen(needNavigation));
		if(navigationFile)	navigationFile.Close();
		return true;
	}
	else{		
		navigationFile.Open(_T("NAVIGATION.dat"), CFile::modeRead);
		if (navigationFile)
		{
			navigationFile.Read(needNavigation,strlen(needNavigation));  
			navigationFile.Close();
			return needNavigation[0]-48;
		}
		//return false;
	}
}

void NavigationConfig::setNeedNavigation(bool needNavi)
{
	if (fileFind.FindFile(_T("NAVIGATION.dat"), 0)){
		navigationFile.Open(_T("NAVIGATION.dat"), CFile::modeWrite);
		
		this->needNavigation[0]=needNavi+48;
		navigationFile.Write(needNavigation,strlen(needNavigation));

		if(navigationFile)	navigationFile.Close();
	}
}